package display.android.fyales.com.displaytime;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * @author fyales
 * @since 2017/10/16
 */

public class ScreenObserverReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {

        if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)){
            ScreenService.getInstance().setStartTime();
        } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)){
            ScreenService.getInstance().setCloseTime();
        }
    }
}
